package com.yisen.dasan.config;

import com.yisen.dasan.util.ResultData;
import org.springframework.mail.MailException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

import javax.mail.MessagingException;

/**
 * @AuthorList: LiuYiSen
 * @Date: 2020/10/20 12:12
 */
@RestController
public class GlobalExceptionsController {
    @ExceptionHandler(MailException.class)
    public ResultData mailException(MailException e){
        return new ResultData(false, 505, "邮件系统异常", e);
    }
    @ExceptionHandler(MessagingException.class)
    public ResultData mailException(MessagingException e){
        return new ResultData(false, 505, "邮件系统异常", e);
    }
}
